package com.ideal.frame.util;

import org.apache.commons.lang3.StringUtils;
import org.springframework.util.DigestUtils;

/**
 * @Author: jin
 * @CreateTime: 2019-11-05 21:57
 * @Description: md5加密工具类
 */
public class MD5Util {
    //盐，用于混交md5
    private static final String slat = "MD5@slat";

    /**
     * 生成md5
     * @param str
     * @return
     */
    public static String encode(String str) {
        String base = str +"/"+slat;
        String md5 = DigestUtils.md5DigestAsHex(base.getBytes());
        return md5;
    }
}
